package com.example.novelstory.dao.lxy;

//import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;//
import com.example.novelstory.entity.User;
import java.util.List;
import org.apache.ibatis.annotations.*;

//@Mapper
//@Repository//持久层

//在对应的dao里面上面继承基础的类BaseMapper
public interface UserDao extends BaseMapper<User> {
//    此时所有的crud都写完了（接口）
//    //登录？？？
//    @Select("select * from user where username #{username,jdbcType=VARCHAR} and password=#{password,jdbcType=VARCHAR}")
//    public List<User> findByName(@Param("username") String username, @Param("password") String password);
//    //注册？？？
//    @Insert("insert into user(username,email,password,sex,province,city,country) values(#{username,jdbcType=VARCHAR},#{email,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{sex,jdbcType=VARCHAR},#{province,jdbcType=VARCHAR},#{city,jdbcType=VARCHAR},#{country,jdbcType=VARCHAR})")
//    public int InsertUser(@Param("username") String username,@Param("email")String email,@Param("password") String password,@Param("sex")String sex,@Param("province")String province,@Param("city")String city,@Param("country")String country);
//    //添加(后台)
//    @Insert("insert into user(username,email,password,sex,province,city,country) values(#{username,jdbcType=VARCHAR},#{email,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{sex,jdbcType=VARCHAR},#{province,jdbcType=VARCHAR},#{city,jdbcType=VARCHAR},#{country,jdbcType=VARCHAR})")
//    public int addUser(@Param("username") String username,@Param("email")String email,@Param("password") String password,@Param("sex")String sex,@Param("province")String province,@Param("city")String city,@Param("country")String country);
//    //删除（后台）
//    @Delete("delete from user where id=#{id}")
//    public int deleteUser(int id);
//    //修改
//    @Update("update user set password=#{password,jdbcType=VARCHAR} where username=#{username}")
//    public int updateUser(@Param("username")String username,@Param("password") String password);
//    //全查
//    @Select("select * from user")
//    public List<User> findAll();
//    //模糊查询
//    @Select("select * from user where username like concat('%',#{username},'%')")
//    public List<User> findn(String username);
}
